﻿@model SILAS.Entidades.Ciudadano

@{
    ViewBag.Title = "Editar Información Ciudadano";
    Layout = "~/Views/Shared/_LayoutGeneral.cshtml";
}


@section js{


<script type="text/javascript">

    $(function () {

        $("#btnGuardar").click(function () {

            var data = $('form').serialize();

            $.post('@Url.Action("Edit", "Ciudadano")',
                         data,
                         function (ok) {
                             if (ok) {
                                 if (ok.exito == true) {
                                     alert(ok.mensa);
                                     window.location = '@Url.Action("ListarCiudadanos", "Ciudadano")';
                                 }
                                 else {
                                     alert(ok.mensa);
                                 }
                             }
                         }, "json");
            });

      });


    </script>


}


<h2>Edit</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Ciudadano</legend>

        @Html.HiddenFor(model => model.Id)

        <div class="editor-label">
            @Html.LabelFor(model => model.Nombres)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Nombres)
            @Html.ValidationMessageFor(model => model.Nombres)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ApPaterno)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ApPaterno)
            @Html.ValidationMessageFor(model => model.ApPaterno)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ApMaterno)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ApMaterno)
            @Html.ValidationMessageFor(model => model.ApMaterno)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.DNI)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.DNI)
            @Html.ValidationMessageFor(model => model.DNI)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Sexo)
        </div>
        
        <div class="editor-field">
            @Html.DropDownList("Sexo")
            @Html.ValidationMessageFor(model => model.Sexo)
        </div>

       <p style='clear:both;margin-top:10em;padding:1em;'>
                 <!--input type="submit" value="Save" /-->
            <button id="btnGuardar" type="button">Guardar Cambios</button> 
            
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Regresar", "ListarCiudadanos")
</div>


